<%--
  Created by IntelliJ IDEA.
  User: 13095
  Date: 2024/9/5
  Time: 8:56
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set value="${pageContext.request.contextPath}" var="path"></c:set>
<script src="${path}/static/manage/js/jquery-3.6.0.min.js"></script>
<script>
    $(function () {
        $("#cancel").click(cancel);
        $("#myform").submit(check);
    })

    function cancel() {
        location.href = "${path}/web/findPrivateParking";
    }
    function  check(){
       var year= $("#year").val();
        var money=$("#money").val();
        var total=$("#totalmoney").val();
        console.log(money+"......"+total);
        if (year<=0){
            alert("一年起租");
            return false;
        }
        if (money*year>total){
            alert("余额不足");
            return false;
        }
    }

</script>
<link type="text/css" href="${path}/static/web/css/EditStyle.css">
<html>
<head>
    <title>停车位续租</title>
</head>
<body>

    <form action="${path}/web/parkingRenewal" id="myfrom">
        <input type="hidden" value="${requestScope.parking.id}" name="id">
        <input type="hidden" value="${requestScope.parking.endTime}" name="endTime">
        <input type="hidden" value="${requestScope.money}" id="totalmoney">
        <input type="hidden" value="${requestScope.parking.car.id}" name="car.id">
        <table style="margin: 50px auto;">
        <tr>
            <td>车位类型</td>
            <td><input type="text" readonly value="${requestScope.parking.parkingType.typeName}"></td>
        </tr>
        <tr>
            <td>租金</td>
            <td><input type="text" readonly id="money" name="money" value="${requestScope.parking.parkingType.money}">
            </td>
        </tr>
        <tr>
            <td>区域</td>
            <td><input type="text" readonly value="${requestScope.parking.region}" ></td>
        </tr>
        <tr>
            <td>备注</td>
            <td><input type="text" readonly value="${requestScope.parking.beizhu}" ></td>
        </tr>
        <tr>
            <td>剩余时间(天)</td>
            <td><input type="text" value="${requestScope.parking.timeRemaining}" readonly name="timeRemaining"></td>
        </tr>
        <tr>
            <td>租赁时间</td>
            <td><input type="number" name="year"  id="year" width="30">年</td>
        </tr>
        <tr>
            <td>车牌</td>
            <td><input type="text" value="${requestScope.parking.car.license}"></td>
        </tr>
        <tr>
            <td>操作</td>
            <td><input type="submit" value="续租"><input type="button" id="cancel" value="取消"></td>
        </tr>
</table>
    </form>
</body>
</html>
